package com.han.walkman.service.impl;

import com.han.walkman.dao.VisitedPlanDao;
import com.han.walkman.entity.VisitedPlanEntity;
import com.han.walkman.service.VisitedPlanService;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/6/10
 * @Desc:
 */
@Service
public class VisitedPlanServiceImpl implements VisitedPlanService {

    private final VisitedPlanDao visitedPlanDao;

    public VisitedPlanServiceImpl(VisitedPlanDao visitedPlanDao) {
        this.visitedPlanDao = visitedPlanDao;
    }

    @Override
    public void addList(List<VisitedPlanEntity> visitedPlanEntityList) {
        visitedPlanDao.saveAll(visitedPlanEntityList);
    }

    @Override
    public Page<VisitedPlanEntity> findAll(Pageable pageable) {
        return visitedPlanDao.findAll(pageable);
    }

    @Override
    public List<VisitedPlanEntity> findAll(Example<VisitedPlanEntity> entityExample) {
        return visitedPlanDao.findAll(entityExample);
    }

    @Override
    public Page<VisitedPlanEntity> findAll(Example<VisitedPlanEntity> entityExample, Pageable pageable) {
        return visitedPlanDao.findAll(entityExample, pageable);
    }

    @Override
    public Optional<VisitedPlanEntity> findById(Integer id) {
        return visitedPlanDao.findById(id);
    }
}
